package auth;

import java.util.StringTokenizer;

public class AuthenticationManager {
	
	
	private static AuthenticationManager instance = null;

	public static AuthenticationManager getInstance() {
		if (instance == null) {
			instance = new AuthenticationManager();
		}
		return instance;
	}

	private String login;
	
	
	private AuthenticationManager() {
		
	}
	
	public boolean isAuthenticated(String loginInfo){
		try {
			StringTokenizer token = new StringTokenizer(loginInfo.trim(), "#!#");
			String login = token.nextToken();
			String senha = token.nextToken();
			this.login = login;
			//FIXME implementar algo
			if(login.equals("arthurlucio@gmail.com") && senha.equals("senha")){
				return true;
			} else
				return false;
		} catch (Exception e) {
			return false;
		}
	}
	
	public String getLogin() {
		return login;
	}

	

}
